<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use App\Services\CommandHandler;

class CommandServiceProvider extends ServiceProvider
{
    public function register()
    {
        $this->app->singleton(CommandHandler::class, function ($app) {
            $handler = new CommandHandler();
            
            // 允许其他服务提供者注册自定义命令
            $this->registerCustomCommands($handler);
            
            return $handler;
        });
    }

    protected function registerCustomCommands(CommandHandler $handler)
    {
        // 其他开发者可以在这里通过事件或配置来注册自定义命令
        // 例如：
        // $handler->registerCommand('custom', function($args) {
        //     return "This is a custom command";
        // });
    }
}